<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="/static/css/bootstrap.min.css">
    <title>Document</title>
</head>
<body>
    <div class="container-fluid"style="width:80%">
        <div style="margin-bottom:15px;">
            <!-- <input type="button"class="btn btn-primary btn-xs"value="数据统计"> -->
            <input id="btnAdd"type="button"class="btn btn-primary" value="数据统计">
        </div>
        <div class="panel panel-default">
            <div class="panel-heading">完成列表</div>
            <div class="panel-body">
                <table class="table table-bordered table-hover">
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>送水工姓名</th>
                        <th>纯净水</th>
                        <th>数量</th>
                        <th>客户</th>
                        <th>状态</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    {% for obj in queryset%}
                    <tr>
                        <td>{{obj.id}}</td>
                        <td>{{obj.wname}}</td>
                        <td>{{obj.pname}}</td>
                        <td>{{obj.num}}</td>
                        <td>{{obj.cname}}</td>
                        <td>{{obj.get_state1_display}}</td>
                        <td>
                            <!-- <a href="/worker_edit/{{obj.id}}/"class='btn btn-primary btn-xs'>编辑</a> -->
                            <a href="/history_delete/{{obj.id}}/"class='btn btn-danger btn-xs'>删除</a>
                        </td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
            </div>
          </div>
          <div class="clearfix"></div>
        <ul class="pagination"style="float:right">
            {{page_string}}
         </ul>
         <!-- <div id="m2"style="height:300px;width: 100%;"></div> -->
         <!-- #新建对话框 -->
         <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
            <div class="modal-dialog" role="document">
              <div class="modal-content">
                <div class="modal-header">
                  <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                  <h4 class="modal-title" id="myModalLabel">数据统计</h4>
                </div>
                <div class="modal-body">
                    <div id="m2"style="height:300px;width:600px;"></div>
                </div>
                <div class="modal-footer">
                  <button type="button" class="btn btn-default" data-dismiss="modal">关 闭</button>
                  
                </div>
              </div>
            </div>
        </div>
    </div>
    <script src="/static/js/jquery-3.6.0.min.js"></script>  
    <script src="/static/js/bootstrap.min.js"></script> 
    <script src="/static/js/echarts.min.js"></script> 
<script>
    $(function(){
            initBar();
            bindBtnAddEvent();
            
        })
    function bindBtnAddEvent(){
        $("#btnAdd").click(function(){
            
            $("#myModal").modal("show");
        })
    }
    function initBar(){
          // 基于准备好的dom，初始化echarts实例
        var myChart = echarts.init(document.getElementById('m2'));
        // 指定图表的配置项和数据
        var option = {
        title: {
            text: 'ECharts 入门示例'
        },
        tooltip: {},
        legend: {
            data: []
        },
        xAxis: {
            data: []
        },
        yAxis: {},
        series: [
            
        ]
        };
        
        $.ajax({
            url:'/chart_bar/',
            type:'get',
            dataType:"JSON",
            success:function(res){
                if(res.status){
                    
                    option.legend.data=res.data.legend;
                    option.xAxis.data=res.data.xAxis;
                    
                    option.series=res.data.series_list;
                    myChart.setOption(option);
                }
            }
        })
        // 使用刚指定的配置项和数据显示图表。

       
    }
    
</script>


</body>
</html>